<?php

//weiting_chang92
set_time_limit(120);
require_once '../inc/config.php';
header('Content-Type: text/html; charset=UTF-8');
require_once('../inc/facebook.php');
$fb = new Facebook(array(
	'appId'  => FB_APPID,
	'secret' => FB_SECRET,
));
$query = trim(!empty($_POST['query']) ? $_POST['query'] : '/me');
$result = $query[0] == '/' ?
	$fb->api($query) :
	$fb->api(array('method' => 'fql.query', 'query' => $query));

?>
<!DOCTYPE html>
<html>
	<head>
		<title>Facebook API Test Mode</title>
	</head>
	<body>
		<h1>Query</h1>
		<form method="post">
			<div><textarea name="query" cols="80" rows="10"><?php echo htmlspecialchars($query); ?></textarea></div>
			<div><button>Submit Query</button></div>
		</form>
		<h1>Result</h1>
		<pre><?php if (!empty($result)) print_r($result); ?></pre>
	</body>
</html>